#!/bin/sh
host=$(hostname)
echo $host

#get the ip address of the panel
str=$(ifconfig|grep 'inet addr' | awk '{print $2}' | tr -d 'addr:')
ip=$( echo $str|cut -d " " -f 1 )
echo $ip


#get the mac address of the panel
str=$(ifconfig|grep 'HWaddr' | awk '{print $5}' | tr -d 'HWaddr')
mac=$( echo $str|cut -d " " -f 1 )
arr=$(echo $mac| tr ":" "\n")
echo ${arr}


i=0
for addr in $arr
do
	$((i++))
	echo $i
	arrmac[$i]=$addr
done
echo ${arrmac[4]}

echo "insert into SystemMap(RecordID, NodeType,Version, SymbolicName, MACA,MACB,MACC,MACD,MACE,MACF,FlagIsConfiguration, FlagIsEnableEncryption, Ignore, IP_Address, ConfigMode, Reserved1, Reserved2) values (1,0,'', \"$host\", ${arrmac[0]}, ${arrmac[1]}, ${arrmac[2]},${arrmac[3]},${arrmac[4]},${arrmac[5]}, false, false, false, \"$ip\", 0,'',0 )"
